<?php Yii::app()->clientScript->registerCssFile('css/InvoiceReport.css');?>
<div id="invoice-report">
    <div id="create-date">
        <?php echo date('Y-m-d'); ?>
        <br/>
        <?php echo date('H:i:s'); ?>
    </div>

    <div id="title">
        Warehouse Report  
<h5><?php echo Warehouse::getDescription($wid) ?></h5>
    </div>
   
    <div id="content">

        <?php 
        $heading = array('PartNO','QTY','description');
        $table=new CI_Table();
        $table->set_template(array(
            'table_open'=>'<table class="zeebra">'
        ));

        if($cost) 
            $heading  = array_merge($heading , array('Avg Cost','Total Cost'));
         if($reorder) 
            $heading  = array_merge($heading , array('Min QTY','Reorder QTY'));
        $table->set_heading($heading);
     
   
        foreach($data as $partno=>$part){
       
       
           $partData = array( $partno,
                  $part['description'],                 
                   $part['qty']);
           if($cost) $partData =array_merge($partData, array(  '<div style="text-align: right;">'.number_format($part['cost'],2).'</div>',
                                '<div style="text-align: right;">'. number_format($part['qty']* $part['cost'],2).'</div>'));
           if($reorder){
             
                   
             
               $partData =array_merge($partData,array( $part['minqty'],                 
                   $part['reorder']));
           }
            $table->add_row(
             $partData               
                    );
            
        }       
        echo $table->generate();
        ?>
  
    </div>
    
  
  
</div>